<% /* $Id: problems_batch.jsp 132 2011-08-26 10:23:42Z altdotua@gmail.com $ */ %>

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@include file="../header.jsp"%>

<script type="text/javascript" src="js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
	tinyMCE.init({
		// General options
		mode : "textareas",
		theme : "advanced",
		plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
		
		// Theme options
		theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
		theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
		theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		theme_advanced_resizing : true,
 
		// Drop lists for link/image/media/template dialogs
		template_external_list_url : "js/template_list.js",
		external_link_list_url : "js/link_list.js",
		external_image_list_url : "js/image_list.js",
		media_external_list_url : "js/media_list.js",
		 
		// Replace values for the template plugin
		template_replace_values : {
			username : "Some User",
			staffid : "991234"
		}
	});
</script>
 
<h2>Problems</h2>



<table>
	<tr>
<%
	for (Field field : ProblemEntry.class.getDeclaredFields()) if (!field.getName().startsWith("jdo"))
	{
		
%>
	<th><%= field.getName()  %></th>
<%
	}
%>
	<th colspan="3">Actions</th>
	</tr>
	
<%
	List<ProblemEntry> entries2 = ProblemsModel.getAllEntries();
	for (ProblemEntry entry: entries2)
	{
%>
		<tr>
<%
		for (Field field : ProblemEntry.class.getDeclaredFields())
			if (!field.getName().startsWith("jdo"))
			{
%>
		<td><%= !field.getName().equals("statement") ? entry.getFieldValue(field) : "-" %></td>
<%
			}
%>
		<td><a href="<%= Linker.link("admin/problems.jsp?problem_id=" + entry.getId()) %>">Edit</a></td>
		<td><a href="<%= Linker.link("problems?action=copy&id=" + entry.getId()) %>">Copy</a></td>
		<td><a href="<%= Linker.link("problems?action=delete&id=" + entry.getId()) %>">Delete</a></td>
		</tr>
<%
	}
		
%>
	
</table>



<%
	ProblemEntry problem = ProblemsModel.getEntry(Long.parseLong(request.getParameter("problem_id")));
%>
<h2><%= problem == null ? "Add problem" : "Edit problem \"" + problem + "\"" %></h2>
<form action="<%= Linker.link("problems") %>" method="post">
	<input type="hidden" name="action" value="edit_batch">
	<p>SID Prefix: <input name="sid_prefix"></p> 
	<p>SID Start: <input name="sid1"></p>
	<p>SID End: <input name="sidn"><p>
  	<p>TimeLimit: <input name="timeLimit" value="2000"></p>
  	<p>MemoryLimit: <input name="memoryLimit" value="67108864"></p>
  	<p>DJudge contest: <input name="djudgeContest"></p>
  	<p><input type="checkbox" name="active">Доступні?</p>
  	<p><textarea name="statement" style="width:100%"></textarea></p>
  <p><input type="submit" value="Submit"></p>
</form>
<br>

<%@include file="../footer.jsp"%>
